package com.song.book.vo;

import lombok.Data;

/**
 * @author TonySong
 * @date 2024/3/30 0030
 * @time 11:01
 */
@Data
public class R {
    private Integer code;
    private Boolean flag;
    private String message;
    private Object data;

    public static R ok() {
        R r = new R();
        r.setCode(200);
        r.setFlag(true);
        r.setMessage("success");
        return r;
    }
    public static R success(Object data) {
        R r = new R();
        r.setCode(200);
        r.setFlag(true);
        r.setMessage("success");
        r.setData(data);
        return r;
    }

    public static R error(Integer code, String message) {
        R r = new R();
        r.setCode(code);
        r.setFlag(false);
        r.setMessage(message);
        return r;
    }
}